From 3a9bf0fe1d9202862b6c8e45a2575f178eae8aee Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 22 Jan 2015 14:36:33 +0100 Subject: [PATCH] widget: Compute clip of children properly For widgets with a window, we need to adjust the allocation of their children. --- gtk/gtkwidget.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 575db60efd..980e457eef 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -15610,26 +15610,42 @@ _gtk_widget_set_simple_clip (GtkWidget *widget, GtkAllocation *content_clip) { GtkStyleContext *context; - GtkAllocation clip; + GtkAllocation clip, allocation; GtkBorder extents; context = gtk_widget_get_style_context (widget); - gtk_widget_get_allocation (widget, &clip); + gtk_widget_get_allocation (widget, &allocation); _gtk_css_shadows_value_get_extents (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BOX_SHADOW), &extents); + + clip = allocation; clip.x -= extents.left; clip.y -= extents.top; clip.width += extents.left + extents.right; clip.height += extents.top + extents.bottom; if (content_clip) - gdk_rectangle_union (content_clip, &clip, &clip); + gdk_rectangle_union (content_clip, &clip, &clip); if (GTK_IS_CONTAINER (widget)) - gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip); + { + if (gtk_widget_get_has_window (widget)) + { + clip.x -= allocation.x; + clip.y -= allocation.y; + } + + gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip); + + if (gtk_widget_get_has_window (widget)) + { + clip.x += allocation.x; + clip.y += allocation.y; + } + } gtk_widget_set_clip (widget, &clip); } -- 2.30.2